package com.example.basic;

import java.util.concurrent.*;

public class CallableTest implements Callable<Boolean> {

    @Override
    public Boolean call() throws Exception {
        System.out.println(Thread.currentThread().getName());
        return true;
    }

    public static void main(String[] args) throws ExecutionException, InterruptedException {
        ExecutorService executorService = Executors.newFixedThreadPool(5);
        Future<Boolean> submit = executorService.submit(new CallableTest());
        Future<Boolean> submit1 = executorService.submit(new CallableTest());
        Boolean res = submit.get();
        Boolean res1 = submit1.get();
        executorService.shutdown();

    }
}
